package MaintMenu.PoAnalysis;// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   DnkFunctions.java

import java.util.Calendar;

public class DnkFunctionscl {

    public DnkFunctionscl() {
        cal = Calendar.getInstance();
    }

    public String comparePrice(double gn, double depo, double tyg_tx, double ks, double tyg_tw, double gd, String supplier) {
        double bestPrice = 9999D;
        String bestCompany = "null";
        if (supplier.equals("d") || supplier.equals("D"))
            bestCompany = "depo";
        else if (supplier.equals("gn") || supplier.equals("GN"))
            bestCompany = "gn";
        else if (supplier.equals("gd") || supplier.equals("GD")) {
            bestCompany = "gd";
        } else {
            if (gn > 0.0D && gn < bestPrice) {
                bestPrice = gn;
                bestCompany = "gn";
            }
            if (depo > 0.0D && depo < bestPrice) {
                bestPrice = depo;
                bestCompany = "depo";
            }
            if (tyg_tx > 0.0D && tyg_tx < bestPrice) {
                bestPrice = tyg_tx;
                bestCompany = "tyg_tx";
            }
            if (ks > 0.0D && ks < bestPrice) {
                bestPrice = ks;
                bestCompany = "ks";
            }
            if (tyg_tw > 0.0D && tyg_tw * 1.2D < bestPrice) {
                bestPrice = tyg_tw * 1.2D;
                bestCompany = "tyg_tw";
            }
            if (gd > 0.0D && gd * 1.2D < bestPrice) {
                bestPrice = gd * 1.2D;
                bestCompany = "gd";
            }
        }
        return bestCompany;
    }

    public int getCategoryID(String arg) {
        int ctg = 0;
        if (arg.equals("BC"))
            ctg = 1;
        else if (arg.equals("HF"))
            ctg = 2;
        else if (arg.equals("LT"))
            ctg = 3;
        else if (arg.equals("CL"))
            ctg = 4;
        else if (arg.equals("MR"))
            ctg = 5;
        else if (arg.equals("OT"))
            ctg = 6;
        return ctg;
    }

    public int getNeed(int arg, int t3msl) {
        int need = 0;
        if (arg >= 170)
            need = t3msl <= 43 ? 43 : t3msl;
        else if (arg >= 160)
            need = t3msl <= 40 ? 40 : t3msl;
        else if (arg >= 150)
            need = t3msl <= 38 ? 38 : t3msl;
        else if (arg >= 140)
            need = t3msl <= 35 ? 35 : t3msl;
        else if (arg >= 130)
            need = t3msl <= 33 ? 33 : t3msl;
        else if (arg >= 120)
            need = t3msl <= 30 ? 30 : t3msl;
        else if (arg >= 110)
            need = t3msl <= 28 ? 28 : t3msl;
        else if (arg >= 100)
            need = t3msl <= 25 ? 25 : t3msl;
        else if (arg >= 95)
            need = t3msl <= 24 ? 24 : t3msl;
        else if (arg >= 90)
            need = t3msl <= 23 ? 23 : t3msl;
        else if (arg >= 85)
            need = t3msl <= 21 ? 21 : t3msl;
        else if (arg >= 80)
            need = t3msl <= 20 ? 20 : t3msl;
        else if (arg >= 75)
            need = t3msl <= 19 ? 19 : t3msl;
        else if (arg >= 70)
            need = t3msl <= 18 ? 18 : t3msl;
        else if (arg >= 65)
            need = t3msl <= 16 ? 16 : t3msl;
        else if (arg >= 60)
            need = t3msl <= 15 ? 15 : t3msl;
        else if (arg >= 55)
            need = t3msl <= 14 ? 14 : t3msl;
        else if (arg >= 50)
            need = t3msl <= 13 ? 13 : t3msl;
        else if (arg >= 45)
            need = t3msl <= 11 ? 11 : t3msl;
        else if (arg >= 40)
            need = t3msl <= 10 ? 10 : t3msl;
        else if (arg >= 35)
            need = t3msl <= 9 ? 9 : t3msl;
        else if (arg >= 30)
            need = t3msl <= 8 ? 8 : t3msl;
        else if (arg >= 25)
            need = t3msl <= 6 ? 6 : t3msl;
        else if (arg >= 21)
            need = t3msl <= 5 ? 5 : t3msl;
        else if (arg >= 12)
            need = t3msl <= 4 ? 4 : t3msl;
        else if (arg >= 9)
            need = t3msl <= 3 ? 3 : t3msl;
        else if (arg >= 5)
            need = t3msl <= 2 ? 2 : t3msl;
        else if (arg >= 2)
            need = t3msl <= 1 ? 1 : t3msl;
        else
            need = 0;
        return need;
    }

    public int getNeed1(int arg, int byr, int eyr, int n, int t3msl) {
        int need = 0;
        int year1 = cal.get(1);
        if (arg >= 170)
            need = t3msl > 32 ? 10 : 0;
        else if (arg >= 160)
            need = t3msl > 30 ? 10 : 0;
        else if (arg >= 150)
            need = t3msl > 28 ? 5 : 0;
        else if (arg >= 140)
            need = t3msl > 26 ? 5 : 0;
        else if (arg >= 130)
            need = t3msl > 24 ? 5 : 0;
        else if (arg >= 120)
            need = t3msl > 22 ? 5 : 0;
        else if (arg >= 110)
            need = t3msl > 20 ? 5 : 0;
        else if (arg >= 100)
            need = t3msl > 19 ? 5 : 0;
        else if (arg >= 95)
            need = t3msl > 18 ? 5 : 0;
        else if (arg >= 90)
            need = t3msl > 17 ? 5 : 0;
        else if (arg >= 85)
            need = t3msl > 16 ? 5 : 0;
        else if (arg >= 80)
            need = t3msl > 15 ? 5 : 0;
        else if (arg >= 75)
            need = t3msl > 14 ? 5 : 0;
        else if (arg >= 70)
            need = t3msl > 13 ? 5 : 0;
        else if (arg >= 65)
            need = t3msl > 12 ? 5 : 0;
        else if (arg >= 60)
            need = t3msl > 11 ? 5 : 0;
        else if (arg >= 55)
            need = t3msl > 10 ? 5 : 0;
        else if (arg >= 50)
            need = t3msl > 9 ? 4 : 0;
        else if (arg >= 45)
            need = t3msl > 8 ? 4 : 0;
        else if (arg >= 35)
            need = t3msl > 7 ? 3 : 0;
        else if (arg >= 30)
            need = t3msl > 5 ? 3 : 0;
        else if (arg >= 25)
            need = t3msl > 4 ? 2 : 0;
        else if (arg >= 21)
            need = t3msl > 3 ? 2 : 0;
        else if (arg >= 15)
            need = t3msl > 2 ? 2 : 0;
        else if (arg >= 12)
            need = t3msl > 2 ? 1 : 0;
        else if (arg >= 10)
            need = t3msl > 1 ? 2 : 0;
        else if (arg >= 9)
            need = t3msl > 1 ? 1 : 0;
        else if (arg >= 3)
            need = 1;
        else if (arg >= 2 && eyr > year1 - 4)
            need = 1;
        else if (arg >= 1 && eyr > year1 - 1)
            need = 1;
        else
            need = 0;
        return need;
    }

    public int getNeedLT(int arg) {
        int need = 0;
        if (arg >= 170)
            need = 7;
        else if (arg >= 140)
            need = 6;
        else if (arg >= 120)
            need = 5;
        else if (arg >= 90)
            need = 4;
        else if (arg >= 21)
            need = 3;
        else if (arg >= 10)
            need = 2;
        else if (arg >= 6)
            need = 1;
        else
            need = 0;
        return need;
    }

    public int getNeedLT1(int arg, int byr, int eyr, int n, int t3msl) {
        int need = 0;
        int year1 = cal.get(1);
        if (arg >= 170)
            need = 7;
        else if (arg >= 140)
            need = 6;
        else if (arg >= 120)
            need = 5;
        else if (arg >= 90)
            need = 4;
        else if (arg >= 65)
            need = 3;
        else if (arg >= 41)
            need = 2;
        else if (arg >= 31)
            need = 1;
        else if (arg >= 21)
            need = t3msl <= Math.round(arg / 4) ? 1 : Math.round(t3msl / 3);
        else if (arg >= 16)
            need = 1;
        else if (arg >= 10)
            need = t3msl <= 4 ? 1 : 2;
        else if (arg >= 3)
            need = 1;
        else if (arg >= 2 && eyr > year1 - 5)
            need = 1;
        else if (arg >= 1 && eyr > year1 - 4 && n != 0)
            need = 1;
        else
            need = 0;
        return need;
    }

    Calendar cal;
}
